package cn.bonoon.controllers.faq;

import java.util.List;

import cn.bonoon.core.plugins.FaqCatalogService;
import cn.bonoon.entities.interacting.FaqCatalogEntity;
import cn.bonoon.kernel.events.DialogEvent;
import cn.bonoon.kernel.support.models.Item;
import cn.bonoon.kernel.support.services.IService;
import cn.bonoon.kernel.web.EmbedType;
import cn.bonoon.kernel.web.annotations.form.FormDetail;
import cn.bonoon.kernel.web.annotations.form.InsertCell;
import cn.bonoon.kernel.web.annotations.form.PropertyDetail;
import cn.bonoon.kernel.web.handlers.DialogFormInitializer;
import cn.bonoon.kernel.web.models.DialogModel;

@FormDetail(2)
@InsertCell(name = "发布到", value = "/sys/release-module-readonly.vm", colspan = 1, type = EmbedType.PARSE)
public class FaqCatalogDetail implements FaqCatalogDefine, DialogFormInitializer<FaqCatalogEntity> {
	
	@PropertyDetail(value = 0, colspan = 1)
	private String name;

	@PropertyDetail(10)
	private int ordinal;
	@PropertyDetail(11)
	private String level;

	@PropertyDetail(20)
	private String platform;
	@PropertyDetail(21)
	private String disable;

	@PropertyDetail(30)
	private String creatorName;
	@PropertyDetail(31)
	private String createAt;

	@PropertyDetail(value = 100, colspan = 1)
	private String remark;

	@Override
	public Object init(IService<FaqCatalogEntity> service, DialogModel model,
			DialogEvent event, Long id, Object form) throws Exception {
		FaqCatalogService faqCatalogService = (FaqCatalogService)service;
		List<Item> modules = faqCatalogService.releasePlaform(event, id);
		model.addObject("modules", modules);
		return form;
	}
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getOrdinal() {
		return ordinal;
	}

	public void setOrdinal(int ordinal) {
		this.ordinal = ordinal;
	}

	public String getLevel() {
		return level;
	}

	public void setLevel(String level) {
		this.level = level;
	}

	public String getPlatform() {
		return platform;
	}

	public void setPlatform(String platform) {
		this.platform = platform;
	}

	public String getDisable() {
		return disable;
	}

	public void setDisable(String disable) {
		this.disable = disable;
	}

	public String getCreatorName() {
		return creatorName;
	}

	public void setCreatorName(String creatorName) {
		this.creatorName = creatorName;
	}

	public String getCreateAt() {
		return createAt;
	}

	public void setCreateAt(String createAt) {
		this.createAt = createAt;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}
	
}
